[t:/]$ 지식_

S5PC100 Software Reset

2011/11/23

cpu.c 의 P-V 매핑 테이블에 Software Reset 용 레지스터를 등록한다.

arch/arm/plat-s5pcxx/cpu.c 

126라인

        }, {
                .virtual        = (unsigned long)S5PC1XX_VA_APC + 0x100000,
                .pfn            = __phys_to_pfn(0xE0200000),   // SW Reset을 할 수 있다.
                .length         = SZ_4K,
                .type           = MT_DEVICE,
        },

가상 주소 매핑을 계획적으로 해야 나중에 알아보기 쉬운데.. 내가 가진 소스는 아조 카오스다. 걍 마지막에 일단 대충 때려박자.

나중에 0XC100을 넣으면 리셋된다.

 *(unsigned int *)(S5PC1XX_VA_APC + 0x100000) = 0xC100;

리셋 판별은 다음과 같이 한다.

static int reset_status_func(void)
{

        unsigned int reset_status;

        reset_status = *(unsigned int *)(0xE0108300); // 리셋 판별 주소다.

        printf("\nReset = %s\n", reset_status == 0x20 ? "Soft Reset" : "Hard Reset");

        return reset_status == 0x20 ? 1 : 0;
}

이 코드는 물리주소를 직접 쓴 것이다. 즉 u-boot 코드임을 주의.





공유하기













[t:/] is not "technology - root". dawnsea, rss